Test Series - Data Structure

Test Number 88/115

Q: Pointer manipulation is generally more time-consuming than multiplication and division.
A. true
B. false
C. ...
D. ...
Solution: Use of pointers for merging reduces the speed of other operations. This is the main drawback of all advanced data structures.
Q: How many properties does a leftist heap support?
A. 1
B. 2
C. 3
D. 4
Solution: A leftist heap supports two properties- structural property, ordering property and a heap order property.
Q: In a leftist heap, the null path length of a null node is defined as?
A. 1
B. 0
C. null
D.  -1
Solution: In a leftist heap tree, the null path length of a null node with no children is defined as -1.
Q: How many nodes does a leftist tree with r nodes must have?
A. 2r
B. 2r-1
C. 2r
D. 2r-1
Solution: A leftist tree with r nodes on the right path is proved to have at least 2r-1 nodes. This theorem is proved by induction.
Q: Which of the following operations does not destroy the leftist heap property?
A. insert
B. merge
C. delete
D. swap
Solution: Performing insert and merge operations on the right path could destroy the leftist heap property. It is extremely easy to restore that property.
Q: What is the fundamental operation on leftist heap?
A. insertion
B. merging
C. deletion
D. swapping
Solution: The fundamental operations on leftist heaps is merge. Insertion operation is a merge of a one-node heap with a larger heap.
Q: A leftist heap is also said to be a binary heap.
A. true
B. false
C. ...
D. ...
Solution: A leftist heap has a structural property and an ordering property which is similar to that of a binary heap. Hence, leftist heap is also said to be binary heap.
Q: What is the efficiency of merge used in leftist heaps?
A. O(N)
B. O(N log N)
C. O(M log N)
D. O(log N)
Solution: The efficiency of merge operations in leftist heap is mathematically found to be O( log N) which is the same in binary heaps.
Q: What is the node path length of a node with 0 or 1 child?
A. 1
B. -1
C. 0
D. null
Solution: The length of the shortest path from a node to a node without two children is defined as 0.
Q: Why is this heap named leftist heap?
A. only left subtrees exist
B. the tree is biased to get deep down the left
C. it is balanced
D. right trees are unbalanced
Solution: The heap is named as leftist heap because it tends to have deep left paths. It follows that the right path ought to be short.

You Have Score    /10